package com.setting.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.entity.Sysdic;
import com.setting.entity.JsonSys;
import com.utils.JsonResult;
import com.utils.JsonSysdic;
import com.setting.service.SysdicService;

/**
 * @Title: SysdicController.java
 * @Package com.setting.controller
 * @author 孙梦楠
 * @date 2017年11月3日 下午2:09:35
 * @version V1.0.0
 */
@RestController
@RequestMapping(value = "/setting/sys")
public class SysdicController {

	@Autowired
	private SysdicService sysdicservice;

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public JsonResult<List<JsonSys>> listjsonsys() {

		return sysdicservice.listjsonsys();
	}

	@RequestMapping(value = "/getbyid", method = RequestMethod.POST)
	public JsonResult<JsonSys> updateviewjsonsys(@RequestBody JsonSys Jsonsys) {

		Integer sysdicid = Jsonsys.getSysdicid();

		return sysdicservice.updateviewsysdic(sysdicid);
	}

	@RequestMapping(value = "/delect", method = RequestMethod.POST)
	public JsonResult<Sysdic> delect(@RequestBody JsonSys Jsonsys) {

		Integer sysdicid = Jsonsys.getSysdicid();

		return sysdicservice.delectsysdic(sysdicid);
	}

	@RequestMapping(value = "/update", method = RequestMethod.POST)
	public JsonResult<Sysdic> update(@RequestBody JsonSys Jsonsys) {

		Integer sysdicid = Jsonsys.getSysdicid();
		String sysdictype = Jsonsys.getSysdictype();
		String sysdicname = Jsonsys.getSysdicname();
		String sysdicvalue = Jsonsys.getSysdicvalue();
		String sysdicdisplay = Jsonsys.getSysdicdisplay();
		String sysdicdisplay_e = Jsonsys.getSysdicdisplay_e();
		String sysdicremake = Jsonsys.getSysdicremake();

		return sysdicservice.updatesys(sysdicid, sysdictype, sysdicname, sysdicvalue, sysdicdisplay, sysdicdisplay_e,
				sysdicremake);
	}

	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public JsonResult<Sysdic> add(@RequestBody JsonSys Jsonsys) {

		String sysdictype = Jsonsys.getSysdictype();
		String sysdicname = Jsonsys.getSysdicname();
		String sysdicvalue = Jsonsys.getSysdicvalue();
		String sysdicdisplay = Jsonsys.getSysdicdisplay();
		String sysdicdisplay_e = Jsonsys.getSysdicdisplay_e();
		String sysdicremake = Jsonsys.getSysdicremake();

		return sysdicservice.addsys(sysdictype, sysdicname, sysdicvalue, sysdicdisplay, sysdicdisplay_e, sysdicremake);
	}

}
